package com.emex.app.web;

import com.emex.app.shared.data.Cashbox;
import com.emex.app.shared.data.Orders;
import com.emex.app.shared.data.OrderPayment;
import com.emex.app.shared.data.OrderPosition;
import com.emex.app.shared.ws.OrderWebService;
import com.emex.app.web.service.OrderPaymentService;
import com.emex.app.web.service.OrderPositionService;
import com.emex.app.web.service.OrderService;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

/**
 *
 * @author Sergey Karavaev
 */
@WebService(serviceName = "OrderWS", portName = "OrderWSPort", targetNamespace = "http://emex.com/Order")
@Stateless(name = "OrderWS")
public class OrderWS extends SpringBeanAutowiringSupport implements OrderWebService {

    @Autowired
    private OrderService orderService;

    @Autowired
    private OrderPaymentService orderPaymentService;

    @Autowired
    private OrderPositionService orderPositionService;

    @Override
    public int deleteOrderPaymentByPrimaryKey(Integer id) {
        return orderPaymentService.deleteOrderPaymentByPrimaryKey(id);
    }

    @Override
    public OrderPayment insertOrderPayment(OrderPayment record) {
        return orderPaymentService.insertOrderPayment(record);
    }

    @Override
    public List<OrderPayment> getOrderPaymentByOrderId(Integer orderId) {
        return orderPaymentService.getOrderPaymentByOrderId(orderId);
    }

    @Override
    public OrderPayment selectOrderPaymentByPrimaryKey(Integer id) {
        return orderPaymentService.selectOrderPaymentByPrimaryKey(id);
    }

    @Override
    public OrderPayment updateOrderPaymentByPrimaryKey(OrderPayment record) {
        return orderPaymentService.updatOrderPaymentByPrimaryKey(record);
    }

    @Override
    public int deleteOrderPositionByPrimaryKey(Integer id) {
        return orderPositionService.deleteOrderPositionByPrimaryKey(id);
    }

    @Override
    public OrderPosition insertOrderPosition(OrderPosition record) {
        return orderPositionService.insertOrderPosition(record);
    }

    @Override
    public List<OrderPosition> getOrderPositionByOrderId(Integer orderId) {
        return orderPositionService.getOrderPositionByOrderId(orderId);
    }

    @Override
    public OrderPosition selectOrderPositionByPrimaryKey(Integer id) {
        return orderPositionService.selectOrderPositionByPrimaryKey(id);
    }

    @Override
    public OrderPosition updateOrderPositionByPrimaryKey(OrderPosition record) {
        return orderPositionService.updateOrderPositionByPrimaryKey(record);
    }

    @Override
    public int deleteOrderPrimaryKey(Integer id) {
        return orderService.deleteOrderPrimaryKey(id);
    }

    @Override
    public Orders insertOrders(Orders record) {
        return orderService.insertOrder(record);
    }

    @Override
    public Orders selectOrderByPrimaryKey(Integer id) {
        return orderService.selectOrderByPrimaryKey(id);
    }

    @Override
    public Orders updateOrdersByPrimaryKey(Orders record) {
        return orderService.updateOrderByPrimaryKey(record);
    }

    @Override
    public List<Orders> getAllClientOrders(Integer clientId) {
        return orderService.getAllClientOrders(clientId);
    }
    
    @Override
    public List<Orders> getAllJuridicalClientOrders(Integer jurClientId) {
        return orderService.getAllJuridicalClientOrders(jurClientId);
    }

    @Override
    public List<Orders> getOrdersByDate(Date startDate, Date endDate) {
        return orderService.getOrdersByDate(startDate, endDate);
    }

    @Override
    public List<OrderPayment> getOrderPaymentsByDate(Date startDate, Date endDate) {
        return orderPaymentService.getOrderPaymentsByDate(startDate, endDate);
    }

    @Override
    public List<OrderPayment> getOrderPaymentByClientId(Integer clientId) {
        return orderPaymentService.getOrderPaymentByClientId(clientId);
    }

    @Override
    public List<OrderPayment> getOrderPaymentsByDateEqualOrGrater(Date date) {
        return orderPaymentService.getOrderPaymentsByDateEqualOrGrater(date);
    }

    @Override
    public Cashbox insertCashbox(Cashbox record) {
        return orderPaymentService.insertCashbox(record);
    }

    @Override
    public Cashbox getCashBox() {
        return orderPaymentService.getCashBox();
    }
}
